package com.zelin;

import org.csource.fastdfs.*;

public class FastDFSDemo {
    public static void main(String[] args) throws Exception {
        //1.读取配置文件
        ClientGlobal.init("D:\\idea-projects\\20190422\\pinyougou-parent\\fastDFSdemo\\src\\main\\resources\\fdfs_client.conf");
        //2.构造TrackerServer服务器
        //2.1)构造TackerClient
        TrackerClient trackerClient = new TrackerClient();
        //2.2)构造得到TrackerServer
        TrackerServer trackerServer = trackerClient.getConnection();
        //3.定义StorageServer对象
        StorageServer storageServer = null;
        //4.定义StorageClient对象
        StorageClient storageClient = new StorageClient(trackerServer,storageServer);
        //5.进行文件上传
        String[] strings = storageClient.upload_file("d:/abc.png", "png", null);
        System.out.println("文件上传成功!");
        //6.打印
        for (String string : strings) {
            System.out.println(string);
        }
    }
}
